<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/8/2
 * Time: 9:46
 *充值记录表
 */

namespace App\Modules\Recharge;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class RechargeRecord extends Model
{
    use SoftDeletes;

    const PAID = 1;
    const UNPAID = 0;

    const USER_RECHARGE = 0;
    const SYSTEM_RECHARGE = 1;
    const COST_RECHARGE = 2;

    public static $statusShow = [
        self::PAID => "已支付",
        self::UNPAID => "未支付",
    ];
    public static $recharge = [
        self::USER_RECHARGE => "购买商品获得",
        self::SYSTEM_RECHARGE => "系统充值",
        self::COST_RECHARGE => "用户消费减少",
    ];

    public function getStatusAttribute($value)
    {
        return self::$statusShow[$value];
    }

    public function getRechargeModeAttribute($value)
    {
        return self::$recharge[$value];
    }

    protected $fillable = [
        'order_no',
        'shop_id',
        'user_id',
        'cz_money',
        'zs_money',
        'total',
        'recharge_mode',
        'status',
        'operator',
        'package_id',
        'good_id',
        'order_id',
    ];
}
